/*
 * @Author: xiaoyan
 * @Date: 2021-09-10 11:17:18
 * @LastEditors: xiaoyan
 * @LastEditTime: 2021-09-10 11:19:09
 * @Description: 前端缓存
 * @FilePath: \vue-ts-basic\src\utils\storage.ts
 */
import Cookies from 'js-cookie'

const TokenKey = 'token'

//token存cookie
export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token:string) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
//其他数据存localStorage
export function setStorage(name:string,value:string){
  return localStorage.setItem(name, value)
}
export function getStorage(name:string){
  return localStorage.getItem(name)
}
export function removeStorage(name:string) {
  return localStorage.removeItem(name)
}